/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.swirrel.listener;

import java.awt.event.TextEvent;
import java.awt.event.TextListener;
import org.swirrel.util.MethodCall;
import org.swirrel.util.SwirrelException;

/**
 *
 * @author Gronau
 */
public class SwirrelTextListener extends AbstractSwirrelListener implements TextListener{

    private final MethodCall textValueChangedCall;

    public SwirrelTextListener(MethodCall textValueChangedCall) {
        this.textValueChangedCall = textValueChangedCall;
        if(! checkSignature(textValueChangedCall, TextEvent.class)) {
            throw new SwirrelException("Method must have none or one TextEvent argument");
        }
    }

    public void textValueChanged(TextEvent e) {
        call(textValueChangedCall, e);
    }

}
